To POST a new annotation to an Annotation Container you POST valid W3C Web Annotation JSON to that container URI, with Accept
and Content-Type
headers.
POST /annotation/w3c/my-container/ HTTP/1.1Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"Content-Type: application/ld+json;Host: localhost:8080Connection: closeUser-Agent: Paw/3.1.5 (Macintosh; OS X/10.13.4) GCDHTTPRequestContent-Length: 202{"@context": "http://www.w3.org/ns/anno.jsonld","type": "Annotation","body": {"type": "TextualBody","value": "I like this page!"},"target": "http://www.example.com/index.html"}
The Annotation Server will return the Annotation with id
and ETag
.
HTTP/1.1 201Location: http://localhost:8080/annotations//w3c/my-container/e849d4a3-b769-4925-8f08-9214804f0e92ETag: W/"0f3762c6ec155168aa6898252a79877b"Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"Allow: PUT,GET,OPTIONS,HEAD,DELETEVary: AcceptMemento-Datetime: Sun, 20 May 2018 19:32:42 UTCContent-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld";charset=UTF-8Transfer-Encoding: chunkedDate: Sun, 20 May 2018 19:32:42 GMTConnection: close{"@context" : "http://www.w3.org/ns/anno.jsonld","id" : "http://localhost:8080/annotations//w3c/my-container/e849d4a3-b769-4925-8f08-9214804f0e92","type" : "Annotation","body" : {"type" : "TextualBody","value" : "I like this page!"},"target" : "http://www.example.com/index.html"}
If you want to specify the id
of the annotation, you can use a SLUG
header, just as you would with a Container.
POST /annotations/w3c/my-container/ HTTP/1.1Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"Content-Type: application/ld+json;Slug: foo-barHost: localhost:8080Connection: closeUser-Agent: Paw/3.1.5 (Macintosh; OS X/10.13.4) GCDHTTPRequestContent-Length: 249{"@context": "http://www.w3.org/ns/anno.jsonld","type": "Annotation","body": {"type": "TextualBody","value": "This one has a SLUG, so I know what id the annotation will have."},"target": "http://www.example.com/index.html"}
Response:
HTTP/1.1 201Location: http://localhost:8080/annotations//w3c/my-container/foo-barETag: W/"741c3b063c0345ce862a62cf429b2a4b"Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"Allow: PUT,GET,OPTIONS,HEAD,DELETEVary: AcceptMemento-Datetime: Sun, 20 May 2018 19:37:32 UTCContent-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld";charset=UTF-8Transfer-Encoding: chunkedDate: Sun, 20 May 2018 19:37:32 GMTConnection: close{"@context" : "http://www.w3.org/ns/anno.jsonld","id" : "http://localhost:8080/annotations//w3c/my-container/foo-bar","type" : "Annotation","body" : {"type" : "TextualBody","value" : "This one has a SLUG, so I know what id the annotation will have."},"target" : "http://www.example.com/index.html"}